load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target")
load("@fbcode_macros//build_defs:cpp_binary.bzl", "cpp_binary")
load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library")

oncall("fbcode_entropy_wardens_folly")

fbcode_target(
    _kind = cpp_binary,
    name = "fatal_helper",
    srcs = ["FatalHelper.cpp"],
    deps = [
        "//folly/init:init",
        "//folly/logging:logging",
        "//folly/portability:stdlib",
    ],
)

fbcode_target(
    _kind = cpp_binary,
    name = "log_after_main",
    srcs = ["LogAfterMain.cpp"],
    deps = [
        ":helpers",
        ":log_on_shutdown",
        "//folly/init:init",
        "//folly/logging:logging",
    ],
)

fbcode_target(
    _kind = cpp_binary,
    name = "log_after_main_no_init",
    srcs = ["LogAfterMainNoInit.cpp"],
    deps = [
        ":helpers",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "helpers",
    headers = ["helpers.h"],
    exported_deps = [
        "//folly/logging:logging",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "log_on_shutdown",
    srcs = ["LogOnShutdownLib.cpp"],
    deps = [
        ":helpers",
    ],
)
